package com.wind.trademark.user.model;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * AccPermission entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "acc_permission", catalog = "mypro")
public class AccPermission implements java.io.Serializable {

	// Fields

	private Long id;
	private Long parent;
	private String type;
	private String name;
	private Long createBy;
	private Date createTime;
	private Long lastUpdateBy;
	private Date lastUpdateTime;
	private List<AccPermission> children;


	// Constructors



	/** default constructor */
	public AccPermission() {
	}

	/** minimal constructor */
	public AccPermission(String type, String name, Long createBy,
			Date createTime, Long lastUpdateBy, Date lastUpdateTime) {
		this.type = type;
		this.name = name;
		this.createBy = createBy;
		this.createTime = createTime;
		this.lastUpdateBy = lastUpdateBy;
		this.lastUpdateTime = lastUpdateTime;
	}


	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "PARENT")
	public Long getParent() {
		return this.parent;
	}

	public void setParent(Long parent) {
		this.parent = parent;
	}

	@Column(name = "TYPE", nullable = false, length = 1)
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "NAME", nullable = false, length = 20)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "CREATE_BY", nullable = false)
	public Long getCreateBy() {
		return this.createBy;
	}

	public void setCreateBy(Long createBy) {
		this.createBy = createBy;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "CREATE_TIME", nullable = false, length = 10)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "LAST_UPDATE_BY", nullable = false)
	public Long getLastUpdateBy() {
		return this.lastUpdateBy;
	}

	public void setLastUpdateBy(Long lastUpdateBy) {
		this.lastUpdateBy = lastUpdateBy;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "LAST_UPDATE_TIME", nullable = false, length = 10)
	public Date getLastUpdateTime() {
		return this.lastUpdateTime;
	}

	public void setLastUpdateTime(Date lastUpdateTime) {
		this.lastUpdateTime = lastUpdateTime;
	}
	@OneToMany(fetch=FetchType.LAZY)
	@JoinColumn(name="PARENT")
	public List<AccPermission> getChildren() {
		return children;
	}

	public void setChildren(List<AccPermission> children) {
		this.children = children;
	}

}